From: Juergen Gross Date: Sat, 16 Jan 2021 10:33:38 +0000 (+0100) Subject: xen: enable keyhandlers to work without register set specified X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1056 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a4e8b178bfb4ee404cc7329032112d0c18ca4b66;p=xen.git xen: enable keyhandlers to work without register set specified There are only two keyhandlers which make use of the cpu_user_regs struct passed to them. In order to be able to call any keyhandler in non-interrupt contexts, too, modify those two handlers to cope with a NULL regs pointer by using run_in_exception_handler() in that case. Suggested-by: Julien Grall Signed-off-by: Juergen Gross Acked-by: Julien Grall --- diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 68364e987d..38020a1360 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -181,7 +181,10 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs) cpumask_copy(&dump_execstate_mask, &cpu_online_map); /* Get local execution state out immediately, in case we get stuck. */ - dump_execstate(regs); + if ( regs ) + dump_execstate(regs); + else + run_in_exception_handler(dump_execstate); /* Alt. handling: remaining CPUs are dumped asynchronously one-by-one. */ if ( alt_key_handling ) @@ -481,15 +484,23 @@ static void run_all_keyhandlers(unsigned char key, struct cpu_user_regs *regs) tasklet_schedule(&run_all_keyhandlers_tasklet); } -static void do_debug_key(unsigned char key, struct cpu_user_regs *regs) +static void do_debugger_trap_fatal(struct cpu_user_regs *regs) { - printk("'%c' pressed -> trapping into debugger\n", key); (void)debugger_trap_fatal(0xf001, regs); /* Prevent tail call optimisation, which confuses xendbg. */ barrier(); } +static void do_debug_key(unsigned char key, struct cpu_user_regs *regs) +{ + printk("'%c' pressed -> trapping into debugger\n", key); + if ( regs ) + do_debugger_trap_fatal(regs); + else + run_in_exception_handler(do_debugger_trap_fatal); +} + static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs) { alt_key_handling = !alt_key_handling;